package com.shun.controller.api

import com.shun.entity.Dispatch
import com.shun.entity.User
import com.shun.service.DispatchService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

/**
 * Created by Administrator on 2017/8/13.
 */
@RestController
@RequestMapping("/api/v1/dispatch")
class DispatchController {

    @Autowired
    private lateinit var dispatchService: DispatchService

    @PostMapping("/create")
    fun create(@RequestBody params: Map<String, Any>, @SessionAttribute("user") user: User) = dispatchService.create(params, user)

    @GetMapping("/list")
    fun list(@RequestParam params: Map<String, Any?>) = dispatchService.list(params)
}